package cn.wzptsoft.tinymallbe.repository;

import cn.wzptsoft.tinymallbe.entity.Address;
import cn.wzptsoft.tinymallbe.entity.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import java.util.List;

public interface AddressRepository extends JpaRepository<Address,Long> {

    @Query(value = "SELECT * FROM address WHERE user_id = ?1",nativeQuery = true)
    List<Address> findByUserId(@Param("userId") Integer userid);

    Address findByUserIdAndNameAndTelAndAreaAndDetail(Integer userId, String name, String tel, String area, String detail);
}
